#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const int N=2e5+10;
#define INF 0x3f3f3f3f;
typedef long long int ll;
#define close(); std::ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
//----------------------------------------------------------------------------//
ll n,m;
ll a[20];
void solve()
{
	cin >> n;
    ll sum=0,i2; 
    for(int i1=1;i1<=n;i1++)
    cin >> a[i1];
    sort(a+1,a+1+n);
    i2=0;
    for(int i1=1;i1<=n;i1++)
    {
    while(a[i1]>=2&&a[i1]%2==0) {sum++;a[i1]/=2;}
    }
    sort(a+1,a+n+1);
    for(m=1;m<=sum;m++) a[n]*=2;
    sum=0;
    for(m=1;m<=n;m++) sum+=a[m];
    cout <<sum<< '\n';


}

int main()
{
	close();
	int T; cin>>T;
	while (T--) solve();
	return 0;
}

